<div class="col-md-9">
        <?php include ("breadcrumb.php");?>
        <?php if(!empty($category->image)){?>
        <div class="banner_list_sanpham">
            <a href="#"><img src="<?php echo base_url('uploads/images/full/'.$category->image);?>"></a>
        </div>
        <?php }?>
        <div class="list_product_title">
            <div class="list_product_title_1">
                <h3><?php echo !empty($category->name)?$category->name:"";?></h3>
            </div>
            <div class="list_product_title_2">
                <p>Hiện đang có <span class="red"><?php echo !empty($product_count)?$product_count:0 ;?></span> sản phẩm</p>
            </div>
        </div>
        <div class="filte_pagi_wp">
        
        <div class="col-xs-12 col-sm-6 col-md-6">
            <div class="filter_wp">
                <select style="height:34px; background-color:#f8f8f8" class="span3" id="sort_products" onchange="window.location='<?php echo site_url(uri_string());?>/'+$(this).val();">
                    <option value=''><?php echo lang('sort_by_default_new');?></option>
                    <option <?php echo(!empty($_GET['by']) && $_GET['by']=='name/asc')?' selected="selected"':'';?> value="?by=name/asc"><?php echo lang('sort_by_name_asc');?></option>
                    <option <?php echo(!empty($_GET['by']) && $_GET['by']=='name/desc')?' selected="selected"':'';?>  value="?by=name/desc"><?php echo lang('sort_by_name_desc');?></option>
                    <option <?php echo(!empty($_GET['by']) && $_GET['by']=='price/asc')?' selected="selected"':'';?>  value="?by=price/asc"><?php echo lang('sort_by_price_asc');?></option>
                    <option <?php echo(!empty($_GET['by']) && $_GET['by']=='price/desc')?' selected="selected"':'';?>  value="?by=price/desc"><?php echo lang('sort_by_price_desc');?></option>
                </select>
                <!--<input class="filter" name="Lọc theo giá" value="Lọc theo giá" type="button">
                <input class="filter" name="" value="Lọc theo ngày" type="button">-->
            </div>
        </div>
        
        <?php echo $this->pagination->create_links();?>
        
        <div class="clear"></div>
        </div>
        <!--box list san pham-->
        <div class="list_product_wp" style="border: 1px solid #CCC;margin-bottom:15px;">
        <?php if(!empty($category_gift)){foreach($category_gift as $item_cate){if($item_cate->id != 22){$list_id=array();?>
        	<div class="title_head">
				<h3><i class="fa fa-dot-circle-o"></i> <A style="color:#FFF" href="<?php echo site_url("qua-tang/".$item_cate->slug)?>"> <?php echo $item_cate->name?></A></h3>
            </div>
            <ul class="list_product_ul">
       <?php
/*	   	echo "<pre>";
	   		print_r($list_category_product);
			print_r($products);
			exit;*/
            foreach($products as $product):if(!in_array($product->product_id,$list_id) and in_array($product->product_id,$list_category_product[$item_cate->id])){$list_id[] = $product->product_id?>
                <li class="list_product_li col-xs-12 col-sm-6 col-md-4">
                    <div class="list_product">
                <?php
                $photo  = theme_img('no_picture.png', lang('no_image_available'));
                $product->images    = array_values($product->images);
    
                if(!empty($product->images[0]))
                {
                    $primary    = $product->images[0];
                    foreach($product->images as $photo)
                    {
                        if(isset($photo->primary))
                        {
                            $primary    = $photo;
                        }
                    }

                    $photo  = '<img src="'.base_url('uploads/images/thumbnails/'.$primary->filename).'" alt="'.$product->seo_title.'"/>';
                }
                ?>
                        <div>
                            <div class="product_list_image">
                                <?php if(!empty($product->active_docquyen))echo '<div class="rolate_image">Độc quyền</div>'?>
                                <a href="<?php echo site_url(implode('/', $base_url).'/'.$product->slug); ?>"><?php echo $photo; ?></a>
                                <?php if($product->quantity <= 0)echo ' <div class="product_status"><div class="info_status_product">Sản phẩm đang về</div><div class="backgroup_opacity"></div></div>'?>
                            </div>
                            <div class="product_list_text">
                                <h3 style="min-height:30px;">
                                <a class="red" href="<?php echo site_url(implode('/', $base_url).'/'.$product->slug); ?>"><?php echo $product->name;?></a>
                                <?php /*if($this->session->userdata('admin')): ?>
                                    <a class="btn" title="<?php echo lang('edit_product'); ?>" href="<?php echo  site_url($this->config->item('admin_folder').'/products/form/'.$product->id); ?>"><i class="icon-pencil">edit</i></a>
                                <?php endif; */?>
                                </h3>
                                <p><?php echo $product->excerpt; ?></p>
                            </div>
                            <!--
                            <div class="product_list_cart">
                                <a class="red" href="<?php echo site_url(implode('/', $base_url).'/'.$product->slug); ?>"><input class="bt_product_list" value="Sản phẩm chi tiết" name="" type="button"></a>
                            </div>
                            -->
                            
                        
                        
                        
                            <div class="product_list_thanhtoan">
                                <div class="product_list_thanhtoan_1">
                                    <p><span class="gia"><strong>Giá bán</strong></span></p>
                                    <?php if(!empty($price_user[$product->id])){?>
                                        <p><span class="red"><?php echo format_currency($price_user[$product->id]); ?></span></p>
                                    <?php }else{ if($product->price > $product->saleprice and $product->saleprice > 0){?>
                                    <p><span style="text-decoration:line-through"><?php echo format_currency($product->price); ?></span> &nbsp; <span class="red" style="font-size:150%"><?php echo format_currency($product->saleprice); ?></span></p>
                                    <?php }else{?>
                                    <p  style="font-size:150%"><span class="red"><?php echo format_currency($product->price); ?></span></p>
                                    <?php }}?>
                                    <p style="text-align:center"><span class="thue">(chưa bao gồm thuế)</span></p>
                                    
                                    <?php echo form_open('cart/add_to_cart', 'class="form-horizontal"');?>
                                    <input type="hidden" name="cartkey" value="<?php echo $this->session->flashdata('cartkey');?>" />
                                    <input type="hidden" name="id" value="<?php echo $product->id?>"/>
                                    <fieldset>
                                    
                                    <?php /*
                                    <div class="mausac_wp">
                                        <?php if(count($options) > 0): ?>
                                            <?php foreach($options as $option):
                                                $required   = '';
                                                if($option->required)
                                                {
                                                    $required = ' <p class="help-block">Required</p>';
                                                }
                                                ?>
                                                <div class="control-group">
                                                    <label class="control-label" style="margin-bottom:7px"><?php echo $option->name;?></label>
                                                    <?php
                                                    /*
                                                    this is where we generate the options and either use default values, or previously posted variables
                                                    that we either returned for errors, or in some other releases of Go Cart the user may be editing
                                                    and entry in their cart.*/
                                                   
                                                   
                                                    //if we're dealing with a textfield or text area, grab the option value and store it in value
                                                    /*
                                                    if($option->type == 'checklist')
                                                    {
                                                        $value  = array();
                                                        if($posted_options && isset($posted_options[$option->id]))
                                                        {
                                                            $value  = $posted_options[$option->id];
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if(isset($option->values[0]))
                                                        {
                                                            $value  = $option->values[0]->value;
                                                            if($posted_options && isset($posted_options[$option->id]))
                                                            {
                                                                $value  = $posted_options[$option->id];
                                                            }
                                                        }
                                                        else
                                                        {
                                                            $value = false;
                                                        }
                                                    }
                    
                                                    if($option->type == 'textfield'):?>
                                                        <div class="controls">
                                                            <input type="text" name="option[<?php echo $option->id;?>]" value="<?php echo $value;?>" class="span4"/>
                                                            <?php echo $required;?>
                                                        </div>
                                                    <?php elseif($option->type == 'textarea'):?>
                                                        <div class="controls">
                                                            <textarea class="span4" name="option[<?php echo $option->id;?>]"><?php echo $value;?></textarea>
                                                            <?php echo $required;?>
                                                        </div>
                                                    <?php elseif($option->type == 'droplist'):?>
                                                        <div class="controls">
                                                            <select name="option[<?php echo $option->id;?>]">
                                                                <option value=""><?php echo lang('choose_option');?></option>
                    
                                                            <?php foreach ($option->values as $values):
                                                                $selected   = '';
                                                                if($value == $values->id)
                                                                {
                                                                    $selected   = ' selected="selected"';
                                                                }?>
                    
                                                                <option<?php echo $selected;?> value="<?php echo $values->id;?>">
                                                                    <?php echo($values->price != 0)?' (+'.format_currency($values->price).') ':''; echo $values->name;?>
                                                                </option>
                    
                                                            <?php endforeach;?>
                                                            </select>
                                                            <?php echo $required;?>
                                                        </div>
                                                    <?php elseif($option->type == 'radiolist'):?>
                                                        <div class="controls">
                                                            <?php foreach ($option->values as $values):
                    
                                                                $checked = '';
                                                                if($value == $values->id)
                                                                {
                                                                    $checked = ' checked="checked"';
                                                                }?>
                                                                <label class="radio">
                                                                    <input<?php echo $checked;?> type="radio" name="option[<?php echo $option->id;?>]" value="<?php echo $values->id;?>"/>
                                                                    <?php echo($values->price != 0)?'(+'.format_currency($values->price).') ':''; echo $values->name;?>
                                                                </label>
                                                            <?php endforeach;?>
                                                            <?php echo $required;?>
                                                        </div>
                                                    <?php elseif($option->type == 'checklist'):?>
                                                        <div class="controls">
                                                            <?php foreach ($option->values as $values):
                    
                                                                $checked = '';
                                                                if(in_array($values->id, $value))
                                                                {
                                                                    $checked = ' checked="checked"';
                                                                }?>
                                                                <label class="checkbox">
                                                                    <input<?php echo $checked;?> type="checkbox" name="option[<?php echo $option->id;?>][]" value="<?php echo $values->id;?>"/>
                                                                    <?php echo($values->price != 0)?'('.format_currency($values->price).') ':''; echo $values->name;?>
                                                                </label>
                                                                
                                                            <?php endforeach; ?>
                                                        </div>
                                                        <?php echo $required;?>
                                                    <?php endif;?>
                                                    </div>
                                            <?php endforeach;?>
                                        <?php endif;?>
                                    </div>*/?>
                                     <div style="text-align:center">                                                 
                                       <?php if($product->quantity > 0){?> <button style="border:none; margin-top:4px" class="muasanpham" type="submit" value="submit"><i class="fa fa-shopping-cart"></i> <?php echo lang('form_add_to_cart');?></button> <?php } ?>                                                
                                    </div>
                                
                                    </fieldset>
                                    </form>
                                    
                                <!--
                                <!--
                                <div class="product_list_thanhtoan_2">
                                    <p><span class="gia"><strong>Giá:</strong></span></p>
                                    <p><span class="red">300.000 VNĐ</span></p>
                                    <p><span class="thue">(bao gồm thuế)</span></p>
                                    <div class="mausac_wp">
                                    <p><span class="mau">Màu sắc:</span></p>
                                    <select name="">
                                        <optgroup>
                                            <option>1</option>
                                            <option>1</option>
                                            <option>1</option>
                                        </optgroup>
                                    </select>
                                    </div>
                                    <div class="thoigiangiaohang_wp">
                                    <p><span class="mau">Thời gian giao hàng:</span></p>
                                    <select name="">
                                        <optgroup>
                                            <option>1</option>
                                            <option>1</option>
                                            <option>1</option>
                                        </optgroup>
                                    </select>
                                    </div>
                                    <div class="bt_muasanpham_1">
                                        <p><a class="muasanpham_1" href="#"><i class="fa fa-shopping-cart"></i> Mua sản phẩm</a></p>
                                    </div>
                                </div>

                                -->
                                <!-- end gia dinh ky -->
                            </div>
                        </div>
                        <div class="clear"></div>                   
                
                <?php /*
                <div>
                    <?php if($product->saleprice > 0):?>
                        <span class="price-slash"><?php echo lang('product_reg');?> <?php echo format_currency($product->price); ?></span>
                        <span class="price-sale"><?php echo lang('product_sale');?> <?php echo format_currency($product->saleprice); ?></span>
                    <?php else: ?>
                        <span class="price-reg"><?php echo lang('product_price');?> <?php echo format_currency($product->price); ?></span>
                    <?php endif; ?>
                </div>
            
                <?php if((bool)$product->track_stock && $product->quantity < 1 && config_item('inventory_enabled')) { ?>
                    <div class="stock_msg"><?php echo lang('out_of_stock');?></div>
                <?php } ?>
                */?>
                
                    </div> 
                </li>
            <?php } endforeach; ?>
                <div class="clear"></div>
            </ul>
            <?php }}}?>
            <div class="clear"></div>
        </div>
        <!-- TIN TỨC KHUYẾN MÃI, CAMPAIGN -->
        <?php include ("box_promotion_campaign.php");?>                
        <!-- END TIN TỨC KHUYẾN MÃI, CAMPAIGN -->
         <!-- VIDEO -->
        <?php $this->banners->show_collection(5, 10, 'video');?>
        <!-- END VIDEO -->
        <!-- BANNER FOOTER -->
        <?php $this->banners->show_collection(3, 2, 'footer_banner');?>
        <!-- END BANNER FOOTER -->

<?php /* pagination and sort
<?php if(count($products) == 0):?>
<h2 style="margin:50px 0px; text-align:center;">
    <?php echo lang('no_products');?>
</h2>
<?php elseif(count($products) > 0):?>

<div class="row" style="margin-top:20px; margin-bottom:15px">
    <div class="<?php echo ($cols == 4)?'span9':'span6';?>">
        <?php echo $this->pagination->create_links();?>&nbsp;
    </div>
    <div class="span3 pull-right">
        <select class="span3" id="sort_products" onchange="window.location='<?php echo site_url(uri_string());?>/'+$(this).val();">
            <option value=''><?php echo lang('default');?></option>
            <option<?php echo(!empty($_GET['by']) && $_GET['by']=='name/asc')?' selected="selected"':'';?> value="?by=name/asc"><?php echo lang('sort_by_name_asc');?></option>
            <option<?php echo(!empty($_GET['by']) && $_GET['by']=='name/desc')?' selected="selected"':'';?>  value="?by=name/desc"><?php echo lang('sort_by_name_desc');?></option>
            <option<?php echo(!empty($_GET['by']) && $_GET['by']=='price/asc')?' selected="selected"':'';?>  value="?by=price/asc"><?php echo lang('sort_by_price_asc');?></option>
            <option<?php echo(!empty($_GET['by']) && $_GET['by']=='price/desc')?' selected="selected"':'';?>  value="?by=price/desc"><?php echo lang('sort_by_price_desc');?></option>
        </select>
    </div>
</div>
<?php endif;?>
*/?>
</div>